package com.platform.service.impl;

import com.platform.dao.UserAddressDao;
import com.platform.entity.UserAddressEntity;
import com.platform.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Service实现类
 *  会员管理:地址管理
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2017-08-16 15:02:28
 */
@Service("userAddressService")
public class UserAddressServiceImpl implements UserAddressService {
    @Autowired
    private UserAddressDao userAddressDao;

    @Override
    public UserAddressEntity queryObject(Long id) {
        return userAddressDao.queryObject(id);
    }

    @Override
    public List<UserAddressEntity> queryList(Map<String, Object> map) {
        return userAddressDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return userAddressDao.queryTotal(map);
    }

    @Override
    @Transactional
    public int save(UserAddressEntity user) {
        int i = userAddressDao.save(user);
        return 0;
    }

    @Override
    public int update(Long id) {
        return 0;
    }

    @Override
    @Transactional
    public int update(UserAddressEntity entity) {
        userAddressDao.reset(entity.getUserId());
        return userAddressDao.update(entity);
    }

    @Override
    public int delete(Integer id) {
        return userAddressDao.delete(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return userAddressDao.deleteBatch(ids);
    }


}
